// Fill out your copyright notice in the Description page of Project Settings.

#include "DirectorActor.h"
#include "Kismet/GameplayStatics.h"

// Sets default values
ADirectorActor::ADirectorActor()
{
    // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;
}

// Called when the game starts or when spawned
void ADirectorActor::BeginPlay()
{
    Super::BeginPlay();

    // Find the actor that handles control for the local player;
    APlayerController* OurPlayerController = UGameplayStatics::GetPlayerController(this, 0);
    if (OurPlayerController) {
        if (OurPlayerController->GetViewTarget() != CameraScene && CameraScene != nullptr) {
            OurPlayerController->SetViewTarget(CameraScene);
        }
    }
}

// Called every frame
void ADirectorActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
}